﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Core;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Collections;
using System.ComponentModel;

namespace Data.DataGet
{
   public class _DangNhapMK
    {
       DataProvider ob = new SQLProvider();
       public int KiemTraMatKhau(string user, string pass)
       {
           DataTable ds = new DataTable();
           string strSQL = "select UserName,Pass from DangNhap where (UserName = '" + user + "') and (Pass = '" + pass + "')";
           ds = ob.Execute_Table(strSQL);
               if (ds.Rows.Count > 0)
                   return 1;
               else
                   return 0;
       }
       public int Update_MatKhau(string UserName, string Pass)
       {
           string SPName = "update_DangNhap";
           SqlParameter[] para = new SqlParameter[2];
           para[0] = new SqlParameter("@UserName", UserName);
           para[1] = new SqlParameter("@PassNew", Pass);
           if (ob.Execute_Modify(SPName, para) >= 1)

               return 1;
           else
               return 0;
       }
       public DataTable DangNhap(string user, string pass)
       {
           DataTable ds = new DataTable();
           string strSQL = "select * from DangNhap where Username = '" + user + "'" + " and Pass = '" + pass + "'";
           return ds = ob.Execute_Table(strSQL);
       }
    }
}
